//
//  ChangePwdView.m
//  Weiweiyunshi
//
//  Created by 王译 on 17/2/6.
//  Copyright © 2017年 王译. All rights reserved.
//

#import "ChangePwdView.h"

@interface ChangePwdView()<UITableViewDelegate,UITableViewDataSource>

@end



@implementation ChangePwdView

- (instancetype)init
{
    self = [super init];
    if (self) {
        [self createView];
    }
    return self;
}

-(void)createView{
    _changePwdTableView = [[UITableView alloc]initWithFrame:self.frame style:UITableViewStyleGrouped];
    _changePwdTableView.dataSource = self;
    _changePwdTableView.delegate = self;
    _changePwdTableView.scrollEnabled = NO;

    //_changePwdTableView.tableFooterView.frame = CGRectZero;
    [self addSubview:_changePwdTableView];
    _changeButton = [[UIButton alloc]init];
   
    [self addSubview:_changeButton];
    
    _changePwdTableView.sd_layout
    .topSpaceToView(self,0)
    .leftSpaceToView(self,0)
    .widthRatioToView(self,1)
    .heightRatioToView(self,1);
    
    
    _changeButton.sd_layout
    .topSpaceToView(self,200)
    .centerXEqualToView(self)
    .heightIs(40)
    .widthRatioToView(self,0.7);
    [_changeButton setTitle:@"确认修改" forState:UIControlStateNormal];
    _changeButton.backgroundColor = RAN_COLOR
    
    self.userInteractionEnabled = YES;
}



-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 3;
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    UITableViewCell *cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"cell"];
    UITextField *contentTextField = [[UITextField alloc]initWithFrame:CGRectMake(150, 0, 200, cell.frame.size.height)];
    /*_oldPwdTextField = [[UITextField alloc]initWithFrame:CGRectMake(150, 0, 200, cell.frame.size.height)];
    _nowPwdTextField = [[UITextField alloc]initWithFrame:CGRectMake(150, 0, 200, cell.frame.size.height)];
    _confirmPwdTextField = [[UITextField alloc]initWithFrame:CGRectMake(150, 0, 200, cell.frame.size.height)];
    _oldPwdTextField.placeholder = @"原始密码";
    _nowPwdTextField.placeholder = @"新密码";
    _confirmPwdTextField.placeholder = @"确认密码";
     */
    [cell.contentView addSubview:contentTextField];
    switch (indexPath.row) {
        case 0:
            contentTextField.placeholder = @"原始密码";
            self.oldPwdTextField = contentTextField;
            cell.textLabel.text = @"原始密码";
            break;
        case 1:
            contentTextField.placeholder = @"新密码";
            self.nowPwdTextField = contentTextField;
            cell.textLabel.text = @"新密码";
            break;
        case 2:
            contentTextField.placeholder = @"确认密码";
            self.confirmPwdTextField = contentTextField;
            cell.textLabel.text = @"确认密码";
            break;
        default:
            break;
    }
    return cell;
}


@end
